on:startup{
	timer "self",1340,0,"lockon";
}
on:lockon{
	local "x","y","z","x1","y1","z1","offsetx","offsetz","rotz","rotx","percentx","percentz","yaw","temp","yaw";
	$x=getx("self");
	$y=gety("self");
	$z=getz("self");
	$x1=getx("unit",100);
	$y1=gety("unit",100);
	$z1=getz("unit",100);
	$yaw=0;
	$offsetx=$x1-$x;
	$offsetz=$z1-$z;
	$offsety=$y1-$y;
	$temp3=distance("self","unit",100);
	$temp3=$temp3*0.7;
	$pitch=$offsety/$temp3;
	$pitch=$pitch*45;
	$rotx=90;
	$rotz=0;
	if($offsetz>=0){
		$rotz+=180;
		if($offsetx<=0){
			$rotx-=360;
		}
	}
	$temp1=abs($offsetx);
	$temp2=abs($offsetz);
	$temp=$temp1+$temp2;
	$percentx=$offsetx/$temp;
	$percentx=$percentx*$rotx;
	$percentz=$offsetz/$temp;
	$percentz=$percentz*$rotz;
	$yaw+=$percentx+$percentz;
	$temp3=$temp3*1.42;
	$temp3=$temp3/10;
	setrot "self",$pitch,$yaw,0;
	projectile 79,$x,$y+23,$z,1,"unit",100,100,0,$temp3,0.05,0;
	//projectile 79,$x,$y+23,$z,3,$pitch+177,$yaw-2,80,20,0.05,0;
}